// 组织架构模块管理
import request from "@/utils/axios";
import {
  URL_API
} from '@/utils/mUtils'
const base = URL_API()

// 组织
// 组织列表
export function organizationBox(params = {}) {
  return request({
    url: `${base}/api/company/organizational/branch/box`,
    method: "post",
    data: params,
  });
}
// 组织下拉列表
export function branchList(params = {}) {
  return request({
    url: `${base}/api/company/organizational/branch/website_list`,
    method: "post",
    data: params,
  });
}

// 新增组织
export function newlyorganization(params) {
  return request({
    url: `${base}/api/company/organizational/branch/create`,
    method: "post",
    data: params,
  });
}
// 修改组织
export function amendNewlyorgan(params) {
  return request({
    url: `${base}/api/company/organizational/branch/update`,
    method: "put",
    data: params,
  });
}
// 删除组织
export function removeOrganization(params) {
  return request({
    url: `${base}/api/company/organizational/branch/delete`,
    method: "delete",
    data: params,
  });
}
// 组织列表
export function organizationList(params) {
  return request({
    url: `${base}/api/company/organizational/branch/list`,
    method: "post",
    data: params,
  });
}
// 组织详情
export function organizationDetail(params) {
  return request({
    url: `${base}/api/company/organizational/branch/detail`,
    method: "post",
    data: params,
  });
}
// 角色列表
export function roleBox(params={}) {
  return request({
    url: `${base}/api/company/role/box`,
    method: "post",
    data:params
  });
}
// 查询组织
export function queryorganization(params) {
  return request({
    url: `${base}/api/company/organizational/branch/detail`,
    method: "post",
    data: {
      id: Number(params.id),
    },
  });
}
// 停用组织
export function bolckorganization(params) {
  return request({
    url: ``,
    method: "",
    data: params,
  });
}
//   员工
// 员工列表
export function staffListData(params) {
  return request({
    url: `${base}/api/company/organizational/employee/list`,
    method: "post",
    data: params,
  });
}
// 新增员工
export function newLystaff(params) {
  return request({
    url: `${base}/api/company/organizational/employee/create`,
    method: "post",
    data: params,
  });
}
// 角色列表 
export function peopleRole(params) {
  return request({
    url: `${base}/api/company/role/box`,
    method: "post",
    data: params,
  });
}
// 启用员工
export function amendStaff(params) {
  return request({
    url: ``,
    method: "",
    data: params,
  });
}
// 修改员工
export function updateStaff(params) {
  return request({
    url: `${base}/api/company/organizational/employee/update`,
    method: "put",
    data: params,
  });
}
// 查询员工
export function queryStaff(params) {
  return request({
    url: `${base}/api/company/organizational/employee/detail`,
    method: "post",
    data:params
  });
}
// 删除员工
export function removeStaff(params) {
  return request({
    url: `${base}/api/company/organizational/employee/delete`,
    method: "delete",
    data: params,
  });
}
//   角色管理
// 角色列表
export function roleList(params) {
  return request({
    url: `${base}/api/company/role/list`,
    method: "post",
    data: params,
  });
}
// 新增角色
export function NewlyRole(params) {
  return request({
    url: `${base}/api/company/role/create`,
    method: "post",
    data: params,
  });
}
// 修改角色
export function AmenRole(params) {
  return request({
    url: `${base}/api/company/role/update`,
    method: "put",
    data: params,
  });
}
// 删除角色
export function DeleteRole(params) {
  return request({
    url: `${base}/api/company/role/delete`,
    method: "delete",
    data: params,
  });
}
// 查询角色
export function QueryRole(params) {
  return request({
    url: `${base}/api/company/role/detail`,
    method: "post",
    data: params,
  });
}
// 角色树
export function RoleTree(params) {
  return request({
    url: `${base}/api/menu/tree`,
    method: "post",
    data: params,
  });
}
// 用户名是否重复
export function UserCount(params) {
  return request({
    url: `${base}/api/user/count`,
    method: "post",
    data: params,
  });
}
//手机号是否存在
export function mobileCount(params) {
  return request({
    url: `${base}/api/company/customer/employee/count_by_mobile`,
    method: 'post',
    data: params
  })
}


//三级地区搜索
export function getRegionList(params) {
  return request({
    url: `${base}/api/company/region/address_list`,
    data: params,
    method: "post",

  });
}

// 组织部门分级获取
export function levelOptions(params) {
  return request({
    url: `${base}/api/company/organizational/branch/level_options`,
    data: params,
    method: "post",

  });
}
// 获取已绑定的的网点
export function BranchRegionlist(params) {
  return request({
    url: `${base}/api/company/branch/regionlist`,
    data: params,
    method: "post",

  });
}